home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / AIFF DSP v22 / AIFF_DSP_v22.README
Text File  |  1995-02-03  |  4KB  |  42 lines

  1. AIFF_DSP: An Audio IFF File DSP Programmer's Framework in Portable C
  2. available via ftp at "ftp.cs.jhu.edu" in pub/dsp
  3.  
  4. Note for users of previous versions of AIFF_DSP:  The only change in this version is that unlike v21, it includes the correct version of interface.c, which was correct in v20 but not in v21.
  5.  
  6. Introduction
  7. This archive contains code which provides a framework in which user-written C functions which process the data in Audio IFF (AIFF) files are called.  The framework contains main() and deals with all aspects of AIFF file handling, allowing the user to concentrate solely on the development of his/her DSP algorithm.  For those readers who are familiar with Tom Erbe's "SoundHack" program for the Macintosh, this framework is similar to that program except for the fact that source is available and portable and you can add your own processing functions in a very modular, simple way.
  8.  
  9.  
  10. Theory of Operation
  11. The framework calls three user-written functions in the course of its execution.  First it calls a user-written initialization function, which would typically do things like set up lookup tables.  Then it repeatedly calls a user-written processing function, each time placing a new block of data in the buffer.  When the AIFF file has been exhausted of data, it calls a user-written termination function, which would typically do things like free memory which had been malloc()'ed for a lookup table.
  12.  
  13. Though the framework was originally designed for the processing of AIFF files where an AIFF file is taken as input and an AIFF file is made as output, through the setting of user-defined variables, the framework can be made to take no input or make no output.  The mode in which no input is taken is useful for tasks such as the generation of AIFF files by algorithmic means.  The "no output" mode is mode is useful for tasks such as the analysis of AIFF files, where the analysis output goes to the screen or to a non-AIFF file.
  14.  
  15. The three user functions and the the two user variables above are typically defined in their own .c file.  This file contains a global structure which contains the two variables and pointers to the three functions.  This quintuplet defines what I call a "plugin."  The only contact with framework code that needs to occur is to "register" a plugin.  This consists of adding the name of the plugin to lists of other plugins in "plugin_specific.c".  All of these plugins are available at runtime and one is chosen by the end user. 
  16.  
  17. Much more could be written about how to use the framework but time constraints compel me to merely direct the reader to the included examples of processing functions and to the source code for the framework itself.
  18.  
  19.  
  20. Portability
  21. When THINK_C is defined (which happens automatically when that compiler is being used), the program compiles to an executable that does some Macintosh-specific things.  Otherwise, a generic text-mode program is created.  This generic mode has been tested successfully on the following UNIX systems, using gcc except where noted:
  22.  
  23. OS: SunOS 5.3 (UNIX System V Release 4.0)   machine type: sun4d sparc
  24. OS: HP-UX A.09.03   machine type: HP 9000/712
  25. OS: ULTRIX 4.3   machine type: RISC (DECstation 5000/240)
  26. OS: NeXTStep   machine type: NeXT
  27. OS: OSF/1 v2.0   machine type: Alpha (using native DEC cc)
  28.  
  29. On little-endian machines, audio data with a 16 bit sample word size is automatically byte-swapped before delivery to the user-written processing function.  It is byte-swapped back again before being written to the output file.
  30.  
  31. On Macintosh compilers other than Think C, there may be some small modifications needed to the code in "Think_C.c" that sets the file type to 'AIFF'.  Other than that, if you just #define THINK_C, code should work fine on other Macintosh compilers.  The code has been tested successfully on Think C 5.0 and Symantec C++ 7.0.
  32.  
  33.  
  34. Miscellany
  35. If you would like to receive email notification of further updates to these programs, please send mail to my address below.  I am also very interested in hearing what you plan to do or have done with my code, so please drop me a note for that reason as well.
  36.  
  37. This project was funded in part by the Ford Foundation's project to provide grants for undergraduate research at Harvard University.
  38.  
  39. Ben Denckla
  40. bdenckla@fas.harvard.edu
  41. Sunday, January 30, 1995
  42.